#include "macro_config.h"



/**
 * @brief Get the base file name object
 *      获得不包含目录的 文件名
 * @param path 
 * @return char const* 
 */
static char const *get_base_file_name(char const *path)
{
  char const *file_name = path, *curr_str = path;
  while (curr_str && '\0' != *curr_str)
  {
    if ('/' == *curr_str)
      file_name = ++curr_str;
    else
      ++curr_str;
  }
  return file_name;
}





/**
 * @brief 用于断言使用
 * 
 * @param _file_ 
 * @param _function_ 
 * @param _line_ 
 */
void assert_failed(const char* _file_, const char* _function_, int _line_)
{
   printf("-------ASSERT FAIL!!!----\n");
   printf("    File:     ");   printf("%s \n", get_base_file_name(_file_));
   printf("    Function: ");   printf("%s \n", _function_);
   printf("    Line:     ");   printf("%d \n", _line_);
   printf("-------ASSERT   END------\n");
}


void file_name_print(const char* _file_)
{
  printf("[File name]: %s \n", get_base_file_name(_file_));
}


void line_print(int _line_)
{
  printf("[Line]: %d \n", _line_);
}



/**
 * @brief 获得当前世纪秒
 * 
 */
uint64_t get_century_seconds()
{
    time_t current_timer;
    char *candlt;
    current_timer = time(NULL);

    return current_timer;
}


/**
 * @brief Get the candlt object
 * 
 * @return char* 
 */
char* get_candlt()
{
    time_t current_timer;
    char *candlt;
    current_timer = time(NULL);
    candlt = ctime(&current_timer);
    return candlt;
}




